package
{
	import fl.controls.List;
	import fl.controls.listClasses.CellRenderer;
	import fl.data.DataProvider;
	
	import flash.display.Loader;
	import flash.display.LoaderInfo;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.filters.BitmapFilterQuality;
	import flash.filters.BitmapFilterType;
	import flash.filters.ColorMatrixFilter;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.Security;
	import flash.text.TextFormat;
	
	import tools.ToolTip;
	import tools.tween.TweenMax;
	
	[SWF(width=280, height=570, frameRate=24)]
	public class pengxi extends Sprite
	{
		private var loader:Loader;
		private var main:MovieClip;
		private var tab1:Tab;
		private var tab2:Tab;
		private var btn1:Btn;
		private var btn2:Btn;
		private var btn3:Btn;
		private var btn4:Btn;
		private var btn5:Btn;
		private var listPanel:MovieClip;
		private var list:List;
		private var flag:Boolean;
		private var manFront:ManFront;
		
		public function pengxi()
		{
			loader = new Loader();
			loader.load(new URLRequest("renti.swf"));
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);
			
			ToolTip.stage = this.stage;
		}
		 
		private function completeHandler(e:Event):void
		{
			Resource.swf = e.target as LoaderInfo;
			init();
		}
		 
		private function init():void
		{
			main = Resource.getMovieClip("main");
			addChild(main);
			
			tab1 = new Tab();
			main.addChild(tab1);
			tab1.x = 1;
			tab1.text = "部位";
			
			tab2 = new Tab();
			main.addChild(tab2);
			tab2.x = 141;
			tab2.text = "症状";
			
			btn1 = new Btn();
			main.addChild(btn1);
			btn1.x = 46;
			btn1.y = 490;
			btn1.text = "切换背面";
			flag = true;
			btn1.addEventListener(MouseEvent.CLICK,changeBody);
			
			btn2 = new Btn();
			main.addChild(btn2);
			btn2.x = 148;
			btn2.y = 490;
			btn2.text = "选择皮肤";
			btn2.addEventListener(MouseEvent.CLICK,selectSkin);
			
			btn3 = new Btn();
			main.addChild(btn3);
			btn3.x = 172.65;
			btn3.y = 536.25;
			btn3.text = "重填";
			
			listPanel = Resource.getMovieClip("listPanel");
			main.addChild(listPanel);
			listPanel.y = 29;
			
			btn4 = new Btn();
			listPanel.addChild(btn4);
			btn4.x = 46;
			btn4.y = 3;
			btn4.text = "所有症状";
			
			btn5 = new Btn();
			listPanel.addChild(btn5);
			btn5.x = 148;
			btn5.y = 3;
			btn5.text = "常见症状";
			
			list = new List();
			list.setStyle("cellRenderer",CustomCellRenderer);
			listPanel.addChild(list);
			list.y = 35;
			list.width = 280;
			list.height = 460;
			var a:Array = ["头昏","眩晕","瘢痕","丘疹","粉刺","头痛","脓疱","有内眦赘皮","视野缺陷","眼睑腐肉","患眼成斑状","眼球前房内出血","脉络膜视网膜炎","眼眶周围肿","视神经乳头水肿","眼球运动异常","失明","睫毛断裂","虹膜蓝灰色","眼深处疼","剧烈流泪","视觉障碍","局部触痛","前额痛"];
			var dp:Array = [];
			for (var i:int = 0; i < a.length; i++) 
			{
				dp.push({label:a[i]});
			}
			list.dataProvider = new DataProvider(dp);
			listPanel.visible = false;
			
			tab1.addEventListener(MouseEvent.CLICK,click);
			
			manFront = new ManFront();
			addChild(manFront);
			manFront.x = 26;
			manFront.y = 70;
			manFront.addEventListener(MouseEvent.CLICK,clickHandler);
		}
		
		private function clickHandler(e:MouseEvent):void
		{
			listPanel.visible = true;
			manFront.visible = false;
		}
		
		private function click(e:MouseEvent):void
		{
			listPanel.visible = false;
			manFront.visible = true;
		}
		
		private function changeBody(e:MouseEvent):void
		{
			if(flag)
			{
				btn1.text = "切换正面";
				flag = false;
			}else
			{
				btn1.text = "切换背面";
				flag = true;
			}
		}
		
		private function selectSkin(e:MouseEvent):void
		{
			
		}
	}
}